<template>

    <div id="#app">
        <div class="content">


        <h1>{{title}}</h1>

        <el-table style="width: 100%;" :data="tableSituation" header-align="center">
            <el-table-column prop="account" label="学号" header-align="center">
            </el-table-column>
            <!--<el-table-column prop="_class" label="班级" header-align="center" >

            </el-table-column>-->
            <el-table-column prop="name" label="姓名" header-align="center">
            </el-table-column>


            <el-table-column  >
            </el-table-column>
            <el-table-column label="是否提交" header-align="center">
            </el-table-column>
            <el-table-column label="操作" header-align="center">
                <template scope="scope" >
                    <el-button size="small" type="primary" @click.native="go(scope.$index)">查看</el-button>
                    <el-button size="small"  @click.native="">下载</el-button>
                </template>
            </el-table-column>

        </el-table>
        <el-button type="primary" @click="back">返回</el-button>
    </div>
    </div>
</template>

<script>

import axios from 'axios'

    export default{

        data(){
            return {

                title:this.$route.query.title,
                tableSituation: []


            }
        },
        methods: {
            go(index){
                this.$router.push({path: 'studentCheck',query:{account:this.tableSituation[index].account,title:this.title}})
            },
            handleEdit(index, row) {
                console.log(index, row);
            },
            handleDelete(index, row) {
                console.log(index, row);
            },
            back() {

                this.$confirm('是否返回?', '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning'
                }).then(() => {
                    this.$message({
                        type: 'success',
                    });
                    this.$router.go(-1);
                }).catch(() => {
                    this.$message({
                        type: 'info',
                        message: '已返回'
                    });
                });

            },
        },

        mounted:function(){ 
            var course = this.$route.query.course;
            var params = new URLSearchParams();
            params.append('className',this.$store.state.user.course[course][0])
            var _this = this;
            axios.post('/class/getclass',params).then(function(res){
                console.log(res.data.target_class);
                console.log(res.data.target_class.student);
                // _this.tableSituation._class = res.data.targe_class.classNum;
                _this.tableSituation = res.data.target_class.student;

            })
        }

    }
</script>
<style scoped>
    .content {
        width:1200px;
        margin: 0 auto;
    }
</style>